package cn.itcast.solr;

import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.common.SolrInputDocument;
import org.junit.Test;

public class createTest {
    @Test
    public void testWrite()throws Exception{
        HttpSolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr/collection1");
        SolrInputDocument document = new SolrInputDocument();
        document.addField("id",15L);
        document.addField("title","霸王防脱，头发不再脱");
        document.addField("price",998);
        solrServer.add(document);

        System.out.println("hello,I am gitee!");
        solrServer.commit();
    }
}
